#include <iostream>
#include <ros/ros.h>
#include "quad_msgs/GlobalTrajProcess.h"

using std::string;

int main(int argc, char *argv[])
{
    ros::init(argc, argv, "traj_process");
    ros::NodeHandle nh;

    string file_name;
    int operation;
    nh.param("traj_process/file_name", file_name, string(""));
    nh.param("traj_process/operation", operation, 2);

    ros::ServiceClient traj_process_client_ = nh.serviceClient<quad_msgs::GlobalTrajProcess>("traj_process");

    quad_msgs::GlobalTrajProcess srv;
    srv.request.request_type = operation;
    srv.request.file_name = file_name;
    if (traj_process_client_.call(srv))
    {
        if (srv.response.success)
            ROS_INFO("Successfully save trajectory planning results");
        else
            ROS_ERROR("Error occuered while processing trajectory");
    }
    else
        ROS_ERROR("Cannot call trajectory process service");

    return 0;
}
